fix: replace silent catch {} with proper error logging#140
Merged
forketyfork merged 3 commits intomainfrom Jan 19, 2026
Merged
Conversation
Replace 21 instances of bare `catch {}` that silently swallowed errors
with explicit error handling that logs warnings. This follows the
project's CLAUDE.md guideline to "never swallow errors with bare
catch {}".
Changes by file:
- session/state.zig: log processOutput failures
- session/notify.zig: log socket chmod, fcntl, and queue push failures
- main.zig: log input/selection/clear screen failures
- UI components: log action queue failures with scoped loggers
One intentional exception remains in shell.zig for chdir in forked
child process context, documented with a comment explaining why
logging is impractical there.
Correct the "Type Inference with Builtin Functions" section: - The bug occurs when GRID_COLS is comptime_int (not usize) - Fix example to show comptime_int causing the issue - Correct wrap value (wraps to 1, not 0) - Add debug vs release behavior (panic vs silent wrap) - Simplify solution to emphasize `: usize` annotation Also update restart_buttons.zig to follow the recommended pattern: - Add `: usize` annotations to @min results - Remove redundant @as(usize, host.grid_cols) casts
Add comments explaining why WaitContext may leak at shutdown and why this is acceptable: OS reclaims memory anyway, proper xev cancellation would require threading the loop through to deinit, and there's no race condition since xev is single-threaded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
catch {}that silently swallowed errors with explicit error handlingTest plan
zig buildpasseszig build testpassescatch {}remains (in shell.zig fork context)